// pages/billing/billing.js
import http from '../../utils/http.js'
const api = require('../../utils/apiConfig.js')

Page({
  navigateToDelivery: function () {
    wx.navigateTo({
      url: '/pages/delivery/delivery'
    });
  },

  navigateToPurchase: function() {
    wx.navigateTo({
      url: '/pages/purchase/purchase'
    });
  },

  navigateToRetailMode: function() {
    wx.navigateTo({
      url: '/pages/retail-mode/retail-mode'
    });
  },

  /**
   * 页面的初始数据
   */
  data: {
    totalCount: 0,
    totalAmount: 0,
    totalProfit: 0,
    todayProfit: 0,
    customerList: [],
    pagination: {
      page: 1,
      per_page: 10,
      total: 0
    },
    searchName: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    const { page, per_page, total } = this.data.pagination;
    if (page * per_page < total) {
      this.setData({
        'pagination.page': page + 1
      }, () => {
        this.getCustomerList();
      });
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },


})